﻿using System.Web.UI;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Web.Caching;
using Liber.WEB;
using Liber;

namespace SoBusiness.Controllers
{
    public class TradeController :LiberController
    {
        public ViewResult OrderDetail(long oid = -1)
        {
            return View();
        }

        public ViewResult OrderDetail_executeProcess(long oid = -1)
        {
            return View();
        }
        public ViewResult OrderDetail_deliverProcess(long oid = -1)
        {
            return View();
        }

        public ViewResult OrderDetail_payProcess(long oid = -1)
        {
            return View();
        }

        public ViewResult DeliveryBillDetail(long oid = -1)
        {
            return View();
        }

        public ViewResult DeliveryBillPrnt()
        {
            //TODO：标准化模板还是按企业设置不同模板？
            return View();
        }

        [WxSession]
        [NoSession]
        public ViewResult WxOrderDetail(long oid = -1)
        {  
            return View();
        }

        [WxSession]
        [NoSession]
        public ViewResult WxDeliveryBillDetail(long oid = -1)
        {
            return View();
        }

        [WxSession]
        [NoSession]
        public ViewResult WxMyOrders()
        {
            return View();
        }

        public JsonResult GetOrder(long oid = -1)
        {
            return Json(API.Request("TradeSvc@GetOrderDetail")
                           .Set("oid", oid)
                           .WaitResult());
        }

        public JsonResult GetDelivery(long oid = -1)
        {
            return Json(API.Request("TradeSvc@GetDeliveryDetail")
                           .Set("oid", oid)
                           .WaitResult());
        }

        public JsonResult FindOrder(string key)
        {
            return Json(API.Request("TradeSvc@FindOrder").Set("key", key).WaitResult());
        }

        public JsonResult FindDelivery(string key)
        {
            return Json(API.Request("TradeSvc@FindDelivery").Set("key", key).WaitResult());
        }
    }
}